Home:ALL Converter>KafkaListner is not resolving topic name

KafkaListner is not resolving topic name

Ask Time:2020-02-24T01:23:04         Author:keepmoving

Json Formatter

I am working on + spring and java api. Facing really annoying issue. I have used kafka topic pattern approach to listen event for multiple client. Following is the code of kafka consumer in which topic name is coming from config file and suffix has hard code value.

${${service}.topic} value - test-env.demo.*.v1 suffix value is - .cqrs.customer

@KafkaListener(
            topicPattern = "${${service}.topic}" + Constants.suffix,
            groupId = "test",
            id = "test")

So final topic name that will be resolved for customer abc.

test-env.demo.abc.v1.cqrs.customer

and for customer xyz will be

test-env.demo.xyz.v1.cqrs.customer

but when producer emits event on any of following topic. Consumer did not listen anything.

Could someone help me on this.

Thanks

Author:keepmoving,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/60364854/kafkalistner-is-not-resolving-topic-name
yy